#ifndef YK_BASEITEM_H
#define YK_BASEITEM_H

#include <QWidget>
#include <QSqlQuery>
#include <QMap>
#include <QSqlQueryModel>

namespace Ui {
class Yk_baseitem;
}

class Yk_baseitem : public QWidget
{
    Q_OBJECT

public:
    explicit Yk_baseitem(QWidget *parent = nullptr);
    ~Yk_baseitem();

    void closeEvent(QCloseEvent *event);

signals:
    void destroyW( QString );

private slots:
    void on_pbExit_clicked();

    void on_pb_search_itm_clicked();

    void on_leKey_returnPressed();

    void on_tv_config_clicked(const QModelIndex &index);

    void on_tv_config_doubleClicked(const QModelIndex &index);

    void on_pb_new_drug_clicked();

    void item_info_clear();

    void on_pb_save_itm_clicked();

    bool item_check();

    void on_pb_search_cpny_clicked();

    void on_pb_new_company_clicked();

    void on_pb_save_cpny_clicked();

    void generate_specs();

    void on_le_base_dose_textChanged(const QString &arg1);

    void on_cbb_dose_unit_currentTextChanged(const QString &arg1);

    void on_cbb_min_unit_currentTextChanged(const QString &arg1);

    void on_le_pack_qty_textChanged(const QString &arg1);

    void on_cbb_pack_unit_currentTextChanged(const QString &arg1);

    void on_le_trade_name_textChanged(const QString &arg1);

    void on_le_id_code_returnPressed();

    void on_le_company_name_textChanged(const QString &arg1);

private:
    Ui::Yk_baseitem *ui;

    QSqlQuery *qrm, *qro, *qrot;
    //QSqlQueryModel mdList ;//
    QString sq;

    QSqlQueryModel *md_itm, * md_cpny;

    QString store_depts, mode_code_r, mode_code_c,company_code, producer_code, drug_consume_depts;
    //药品包装单位, 最小单位, 剂量单位，系统类别， 药品属性, 药品类别, 药品等级
    QString pack_units, min_units, dose_units, sys_class, drug_quality, drug_type, item_grade;
    //费用类别, 药品剂型, 医师职级
    QString fee_code, dose_models, duty_constrains;

    bool initialFinished;

    bool is_new_drug;

    QMap<QString,QString> item_detail;  //当前选中的项目内容

    bool is_new_fac;

};

#endif // YK_BASEITEM_H
